package com.quarakus.weather.web;

import com.quarkus.weather.service.WeatherService;


import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;

@Path("/weather")
public class WeatherController {

    @Inject
    private WeatherService weatherService;

    @GET
    @Path("/test")
    @Produces(MediaType.TEXT_PLAIN)
    public String weatherOfCity() throws Exception {
        return weatherService.getCityWeather();
    }

    @GET
    @Path("{city}")
    @Produces(MediaType.APPLICATION_JSON)
    public String city(@QueryParam("city") String city) throws Exception {
        return weatherService.getCityWeather(city);
    }

    @GET
    @Path("/hello")
    @Produces(MediaType.TEXT_PLAIN)
    public String hello() throws Exception {
        return weatherService.hello();
    }

}
